package ch4;

public class Driver {
    String name;
    int age;
    String sex;

    public Driver() {
    }

    public void Driver(String n, int a, String s) {
        this.name = n;
        this.age = a;
        this.sex = s;
        System.out.println("这个全能老司机叫" + this.name + ",性别" + this.sex + ",今年" + this.age + "岁。");
    }

    public void Driver(Automobile au) {
        System.out.println("他可以驾驶" + au.nature() + "的汽车" + au.start() + "和" + au.brake());
    }

    public void Driver(Plane p) {
        System.out.println("他可以驾驶" + p.nature() + "的飞机" + p.takeOff() + "和" + p.land());
    }

    public void Driver(Tank t) {
        System.out.println("他可以驾驶" + t.nature() + "的坦克" + t.start() + "和" + t.climb());
    }

    public void Driver(Tractor tr) {
        System.out.println("他可以驾驶" + tr.nature() + "的拖拉机" + tr.start() + "和" + tr.acceleration());
    }

    public void Driver(Ship s) {
        System.out.println("他可以驾驶" + s.nature() + "的航母" +s.start() + "、" + s.siren()+"和" + s.anchor());
    }
}
